<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Home extends Controller{
    function index(){
        $this->load->helper('url');
        $this->transaksi('pesan');
    }

    function transaksi($nama){
        $this->load->helper('url');
//        $data = array{
//            "user" => $this->session->userdata
//        }
        $data = array(
            "user" => $this->session->userdata("username"),
            "bon" => $this->session->userdata("bon"),
            "namacustomer" => $this->session->userdata("namacustomer"),
            "nohp" => $this->session->userdata("nohp")
        );
        

        //load view
        $this->load->view('transaksi/entri_top_view',$this->session->userdata);
        $this->load->view('menu');
        $form = null;
        if ($nama == 'pesan'){
            //load model
            $this->load->model('transaksi/entri_pesan_model','entripesan', TRUE);
            $this->load->library('db_desain');
            $des = $this->db_desain->retr_list_desain();
            $form = $this->entripesan->form($des);
        }
        else if ($nama == 'beli'){
            //load model
            $this->load->model('transaksi/entri_beli_model','entribeli', TRUE);
            $this->load->library('db_desain');
            $des = $this->db_desain->retr_list_desain();
            $form = $this->entribeli->form($des);
        }
         else if ($nama == 'printing'){
            //load model
            $this->load->model('transaksi/entri_printing_model','entriprint', TRUE);
            $form = $this->entriprint->form();
        }
        $this->load->view('transaksi/'. 'entri_'. $nama. '_view', $form);
        $this->load->view('bon_view',$data);
        $this->load->view('transaksi/entri_bottom_view');
    }
}
?>